<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page import="edu.gatech.TNE.wonderLab7000.validation.validation" %>
<%@ page import="edu.gatech.TNE.wonderLab7000.person.person"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login</title>
</head>

<body>
<%
String login = request.getParameter("login");
String password = request.getParameter("password");
validation valid = new validation();
person person = valid.validator(login, password);
session.setAttribute("user", person);

if(person.getAccessLevel() == 0)
{
	pageContext.forward("FailedLoginPage.html");
	return; 
}
else if(person.getAccessLevel() == 1)
{
	pageContext.forward("StudentHome.jsp");
	return;
}
else if(person.getAccessLevel() == 2)
{
	pageContext.forward("TeacherHome.jsp");
	return;
}
else if(person.getAccessLevel() == 3)
{
	pageContext.forward("AdminHome.jsp");
	return;
}
%>
</body>

</html>